package com.sunwayworld.basemodule.business.result.resource.impl;

import com.sunwayworld.basemodule.business.result.bean.LimsResultBean;
import com.sunwayworld.framework.data.page.Page;
import com.sunwayworld.module.sys.at.bean.CoreAuditTrailRecordLineBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.sunwayworld.basemodule.business.result.resource.LimsResultResource;
import com.sunwayworld.basemodule.business.result.service.LimsResultService;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;

@LogModule("结果表")
@RestController
@GikamBean
public class LimsResultResourceImpl implements LimsResultResource {

    @Autowired
    private LimsResultService limsResultService;

    @Override
    public LimsResultService getService() {
        return limsResultService;
    }

    @Log(value = "新增结果表", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Override
    @Log(value = "结果分析项行转列", type = LogType.CONTROLLER)
    public Page<LimsResultBean> selectResultToColumns(Long runId, RestJsonWrapperBean wrapperBean) {
        return getService().selectResultToColumns(runId, wrapperBean);
    }

    @Override
    @Log(value = "结果录入更新数据", type = LogType.CONTROLLER)
    public void updateResultByOrderTaskAndAnalyte(Long orderTaskId, RestJsonWrapperBean wrapperBean) {
        getService().updateResultByOrderTaskAndAnalyte(orderTaskId, wrapperBean);
    }

    @Override
    public LimsResultBean selectDetailByTaskAndAnalyte(Long taskId, Long analyteId) {
        return getService().selectDetailByTaskAndAnalyte(taskId, analyteId);
    }

    @Override
    public Page<LimsResultBean> selectCustomResult(RestJsonWrapperBean wrapper) {
        return getService().selectCustomResult(wrapper);
    }

    @Override
    @Log(value = "审计跟踪记录查询", type = LogType.SELECT)
    public Page<CoreAuditTrailRecordLineBean> selectRecordLineList(String tableName, String id) {
        return getService().selectRecordLineList(tableName, id);
    }

}
